Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make maybe_memory truly optional #2469

Merged
merged 8 commits into from
Mar 4, 2021

Conversation

RReverser
Copy link
Member

@RReverser RReverser commented Feb 26, 2021

As the name implies, it's already optional, but wasn't marked as such in TS.

We could put some more complicated / stricter types here depending on type of the first argument, but at least this fixes the issue for TS consumers.

Also fixes an issue where maybe_memory wouldn't be initialised if the input (module) is given as an ArrayBuffer.

Fixes #2133

As the name implies, it's already optional, but wasn't marked as such in TS.

We could put some more complicated / stricter types here depending on type of the first argument, but at least this fixes the issue for TS consumers.

Fixes rustwasm#2133
@RReverser
Copy link
Member Author

Just noticed the issue with passing in ArrayBuffer too; please don't merge yet, fixing it as well.

It should always be built with nightly, and this file sets the toolchain for Rustup.
 - Unify `init_memory` for `maybe_memory` case to use either the explicitly given value or the default (`new WebAssembly.Memory(...)`).
 - Move it to the main `init` function where all other `imports` are assigned too.
 - Remove global `memory` variable which doesn't seem to be used by anything.
@RReverser
Copy link
Member Author

Done. /cc @alexcrichton @Pauan

@RReverser RReverser changed the title Make maybe_memory optional in TS Make maybe_memory truly optional Feb 26, 2021
tests/wasm/variadic.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, thanks!

examples/raytrace-parallel/rust-toolchain Outdated Show resolved Hide resolved
@alexcrichton alexcrichton merged commit 7f99f03 into rustwasm:master Mar 4, 2021
@RReverser RReverser deleted the maybe-memory branch March 4, 2021 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parameter maybe_memory should be optional
2 participants